package com.cc8w.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.cc8w.entity.TeacherPojo;
import com.cc8w.entity.UserPojo;
import com.cc8w.mapper.UserMapper;
import com.cc8w.util.ReturnData;

@Service("userService")
@Transactional
public class UserService {
	@Autowired
	@Qualifier("userMapper")
	private UserMapper userMapper;
	
	/**
	 * 新增test用户
	 */
	public void insertTest(UserPojo up) {
		userMapper.insertTest(up);
	}
	
	
	/**
	 * 查询用户信息
	 * 
	 */
	public UserPojo queryUserOne() {
		UserPojo userPojo = userMapper.queryUserOne(1);	
		return userPojo;
	}
	
	/**
	 * 查询教师信息
	 * 
	 */
	public TeacherPojo queryTeacherOne() {
		TeacherPojo teacherPojo = userMapper.queryTeacherOne(1);	
		return teacherPojo;
	}
	
	/**
	 * 查询教师信息接收HashMap
	 * 
	 */
	public ReturnData queryTeacherOneByMap() {

		ReturnData teacherPojo = userMapper.queryTeacherOneByMap(1);	
		return teacherPojo;
	}

	/**
	 * 按照用户名查询user
	 */
	public UserPojo queryUserByUserName(String userName){
		UserPojo userPojo = userMapper.queryUserByUserName(userName);
		return userPojo;
	}



}
